package xml;

import org.w3c.dom.Document;
import org.w3c.dom.Node;

public class Nodo extends Item {
    private String value;
    /**
     * Creates a new instance of Nodo
     */
    public Nodo( String name, String value ) {
        super( name );
        this.setValue(value);
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }
    
    public Node toXml( Document doc )
    {
        try
        {
            Node root = doc.createElement(getName());
            root.appendChild(doc.createTextNode("" + value));
      
            return root;

        }
        catch (Exception ex)
        {
            System.err.println(ex.getClass());
            System.err.println(ex.getMessage());
            ex.printStackTrace();
            return null;
        }
    }
    
}
